package learnjava.basic.javaIO.BIO;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * 每个新连接创建一个新线程处理
 */
class Server{

    public static void main(String[] args) {



        try {
            ServerSocket ss = new ServerSocket(9000);
            Socket s;
            while ((s=ss.accept())!=null){
                System.out.println("收到一个客户端链接");
                new ServerThread(s).start();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
